import './ViewTabPanel.scss';

import * as React from 'react';
import { connect } from 'react-redux';
import { removeWorkView } from '../../config/workViewAction';
import ViewTab from './ViewTab';

interface IProps {
  views: any[];
  removeView: any;
}

const ViewTabPanel = ({ views, removeView }: IProps) => {
  return (
    <div className='view-tabs-wrap clearfix'>
      {
        views.map(view => (
          <ViewTab key={view.id} view={view} removeView={removeView} />
        ))
      }
    </div>
  )
}

const mapStateToProps = (state: any) => ({
  views: state.workViewReducer
})

const mapDispatchToProps = (dispatch: any) => ({
  removeView: (view: any) => dispatch(removeWorkView(view))
})

export default connect(mapStateToProps, mapDispatchToProps)(ViewTabPanel)
